<?php
include_once('common/header.php');
if($AppUI->id > 0 && $_SESSION['report'] > 0) {
	$intType		= $objRequest->getParam('typ', 0);
	$intStatus		= $objRequest->getParam('stt', 0);
	$strStart		= $objRequest->getParam('startdate', '');
	$strEnd			= $objRequest->getParam('enddate', '');
	$intPage		= $objRequest->getParam('page', 1);
	$intCancel		= $objRequest->getParam('pcancel', 0);
	$intLimit		= ADMIN_LIMIT;
	$intOff			= (($intPage-1) * $intLimit);
	$intTotal		= 0;
	$arrResult		= null;
	$objReport		= new Report();	
	$arrData		= $objReport->getAll($intType,$intStatus,Vfriend_Function::convertStrToDate($strStart),Vfriend_Function::convertStrToDate($strEnd),$intOff,$intLimit,$intTotal);
	if($arrData) {
		$objBlog		= new Blog();
		$objPhoto		= new Photo();
		$objFullhouse	= new Fullhouse();
		$objNew			= new News();
		$objOffline		= new Offline();
		$objPlace		= new Place();
		foreach($arrData as $value) {
			$intVtype	= $value['type'];
			$intSrcId	= $value['srcid'];
			if($intVtype == 1) {
				$value['info']	= $objBlog->get($intSrcId);
			}elseif($intVtype == 2) {
				$value['info']	= $objPhoto->getPhoto(0, $intSrcId);				
			}elseif($intVtype == 3) {
				$value['info']	= $objFullhouse->get($intSrcId);
			}elseif($intVtype == 4) {
				$value['info']	= $objNew->get($intSrcId);
			}elseif($intVtype == 5) {
				$value['info']	= $objOffline->get($intSrcId);
			}elseif($intVtype == 7) {
				$value['info']	= $objPhoto->getAlbumInfo($intSrcId);
				$value['img']	= $objPhoto->getImageForAlbum($value['info']['albumid']);
			}elseif($intVtype == 8) {
				$value['info']	= $objPlace->get($intSrcId);
			}
			$arrResult[]		= $value;
		}
	}
	$this->view->arrResult		= $arrResult;
	$this->view->intTotal		= $intTotal;
	$this->view->intOffset		= $intOff;
	$this->view->intLimit		= $intLimit;
	$this->view->strUrl			= $strUrl;
	$this->view->arrReport		= $arrReport;
	$this->view->arrStatus		= $arrStatus;
	$this->view->arrType		= $arrReType;
	$this->view->intStatus		= $intStatus;
	$this->view->intType		= $intType;
	$this->view->strUrl			= Vfriend_Function::getUrl();
}
?>